using System.Threading;

namespace Uniriotec.DC.CoordDist.Base
{
    public static class ProcessStarter
    {
        #region Private Fields

        private static int basePort = 5200;

        #endregion

        #region Properties

        public static int BasePort
        {
            get { return basePort; }
            set { basePort = value; }
        }

        #endregion

        #region Start New Process Methods

        public static void StartNew(int totalProc, int numProcess, Process proc)
        {
            StartNew(totalProc, numProcess, proc, basePort);
        }

        public static void StartNew(int totalProc, int numProcess, Process proc, int basePort)
        {
            int port = basePort + numProcess;
            StartProcessParameters parameters = new StartProcessParameters(totalProc, numProcess, port);
            Thread a = new Thread(new ParameterizedThreadStart(proc.Start));
            a.Start(parameters);
            port++;
        }
        
        #endregion
    }
}